<#macro pageTree filepath=''>
	<@_templateList path=filepath>
		<@_metadata dir=filepath><#local metaDataMap=object/></@_metadata>
		<#list list as a>
			<@t.merge 'pages' filepath+'/'+a.fileName/>
		</#list>
		<@_sysDeptPage deptId=admin.deptId!'' pages=t.pages!><#assign deptPageMap=map!/></@_sysDeptPage>
		<#list list as a>
			<#local path=filepath+'/'+a.fileName>
			<#if 'ftl'!=a.fileName&&(deptPageMap[path])?has_content&&deptPageMap[path]>
				<li>
				<#if a.directory>
					<a href="javascript:;" onclick="return false;">
						${a.fileName} ${(metaDataMap[a.fileName].alias)?has_content?then('('+metaDataMap[a.fileName].alias+')','')}
					</a>
					<ul>
						<@pageTree path/>
					</ul>
				<#else>
					<a href="cmsPage/placeList.html?path=${path?url}" target="navTab" title="<i class='icon-globe icon-large'></i> 页面管理" rel="cmsPage/placeList">
						${a.fileName} ${(metaDataMap[a.fileName].alias)?has_content?then('('+metaDataMap[a.fileName].alias+')','')}
					</a>
				</#if>
				</li>
			</#if>
		<#else>
			<li><a>空目录</a></li>
		</#list>
	</@_templateList>
</#macro>
<#macro contentCategoryTree parentId=''>
	<@_categoryList parentId=parentId>
		<#list page.list as a>
			<@t.merge 'categoryIds' a.id!/>
		</#list>
		<@_sysDeptCategory deptId=admin.deptId!'' categoryIds=t.categoryIds!><#assign deptCategoryMap=map!/></@_sysDeptCategory>
		<#list page.list as a>
			<#if (deptCategoryMap[a.id?string])?has_content&&deptCategoryMap[a.id?string]>
				<li>
					<a href="cmsContent/list.html?categoryId=${a.id}" target="navTab" rel="cmsContent/list" title="<i class='icon-book icon-large'></i> 内容管理">${(a.name?html)!}</a>
				<#if a.childIds?has_content>
					<ul>
						<@contentCategoryTree a.id/>
					</ul>
				</#if>
				</li>
			</#if>
		<#else>
			<li><a>空目录</a></li>
		</#list>
	</@_categoryList>
</#macro>
<#macro categoryTree parentId=''>
	<@_categoryList parentId=parentId>
		<#list page.list as a>
			<#if a.childIds?has_content>
			<li>
				<a href="cmsCategory/list.html?categoryId=${a.id}" target="navTab" rel="cmsCategory/list" title="<i class='icon-folder-open icon-large'></i> 分类管理">${(a.name?html)!}</a>
				<ul>
					<@categoryTree a.id/>
				</ul>
			</li>
			</#if>
		</#list>
	</@_categoryList>
</#macro>
<div class="accordion">
<@_sysMoudleList parentId=parentId>
	<#list page.list as a>
		<@t.merge 'moudleIds' a.id!/>
	</#list>
	<@_sysRoleMoudle roleIds=admin.roles moudleIds=t.moudleIds!><#assign roleMoudleMap=map!/></@_sysRoleMoudle>
	
	<#list page.list as a>
		<#if (roleMoudleMap[a.id?string])??&&roleMoudleMap[a.id?string]>
	<div class="accordionHeader">
		<h2>${a.attached!} ${a.name}</h2>
	</div>
	<div class="accordionContent">
	<#switch a.url!''>
		<#case 'cmsContent/list'>
			<ul class="tree treeFolder">
				<li>
					<@_sysDept id=admin.deptId>
						<#assign  dept=object/>
					</@_sysDept>
					<#if dept?has_content&&dept.ownsAllCategory>
						<a href="cmsContent/list.html" target="navTab" rel="cmsContent/list" title="<i class='icon-book icon-large'></i> 内容管理">分类</a>
					<#else>
						<a href="javascript:;" onclick="return false;">分类</a>
					</#if>
					<ul>
						<@contentCategoryTree/>
					</ul>
				</li>
			</ul>
			<#break>
		<#case 'cmsCategory/list'>
			<ul class="tree treeFolder">
				<li>
					<a href="cmsCategory/list.html" target="navTab" rel="cmsCategory/list" title="<i class='icon-folder-open icon-large'></i> 分类管理">分类</a>
					<ul>
						<@categoryTree/>
					</ul>
				</li>
			</ul>
			<#break>
		<#case 'cmsPage/placeList'>
			<ul class="tree treeFolder">
				<@pageTree/>
			</ul>
			<#break>
		<#default>
			<ul class="tree">
			<@_sysMoudleList parentId=a.id>
				<#list page.list as a>
					<@t.merge 'childMoudleIds' a.id!/>
				</#list>
				<@_sysRoleMoudle roleIds=admin.roles moudleIds=t.childMoudleIds!><#assign childRoleMoudleMap=map!/></@_sysRoleMoudle>
				<#list page.list as a>
					<#if (childRoleMoudleMap[a.id?string])?has_content&&childRoleMoudleMap[a.id?string]>
				<li><a href="${(a.url?html)!}" target="navTab" rel="${(a.url?html)!}">${a.attached!} ${(a.name?html)!}</a></li>
					</#if>
				</#list>
			</@_sysMoudleList>
			</ul>
	</#switch>
	</div>
		</#if>
	</#list>
</@_sysMoudleList>
</div>